class Employee:
    def __init__(self,name,salary):
        self.name = name
        self.__salary = salary

    @property
    def salary(self):
        print('薪资是',self.__salary)
        return self.__salary

    @salary.setter
    def salary(self,value):
        if value < 0:
            raise ValueError('薪资不能为负数')
        self.__salary = value
        print('薪资已更新为',self.__salary)

e = Employee('张三',10000)
e.salary = 5000